/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.raitcon.tests;

import com.raitcon.hibernate.bean.Roles;
import com.raitcon.hibernate.db.RolesAccionDB;
import com.raitcon.hibernate.db.RolesDB;
import java.util.List;
import org.hibernate.HibernateException;

/**
 *
 * @author Administrador
 */
public class RolesTest {

    public static void main(String[] args) throws HibernateException, Exception {



        Roles rol = null;
        RolesDB rolDB = new RolesDB();
        List<Roles> listRoles = rolDB.getRolesById(4);
        for (Roles roles : listRoles) {
            rol = roles;
        }

        System.out.println("Inicio");
        System.out.println("cod: " + rol.getIdRol());
        System.out.println("nom: " + rol.getName());
        System.out.println("Fcha Regis: " + rol.getRegistry());
        System.out.println("rol.toString()1: " + rol.toString());
        System.out.println("#############################");
        
        System.out.println("Modificacion");
        rol.setName("Carlos Alberto");
        System.out.println("cod: " + rol.getIdRol());
        System.out.println("nom: " + rol.getName());
        System.out.println("Fcha Regis: " + rol.getRegistry());
        System.out.println("rol.toString()2: " + rol.toString());
        
        rolDB.updateRol(rol, rol.getIdRol());
    }
}
